<?php
//include controller class
//setPageTitle("Hak Akses Pengguna");
?>
<script language="javascript" type="text/javascript">
	
    function getValueSingle(kode, nama, elm) {
        try {
            parent.parent._obj_fSendValue(kode, nama, 'id_biller', 'biller');
        }
        catch(e) { alert(e.message); }
        parent.parent.focus();

<?php echo CloseGB(false); // close grebox  ?>
                 
    }
        
    function setIsActive(kode, id_menu, action, flag) {
        if(confirm('Anda yakin akan mengubah hak akses user '+ kode +' ini ?')) {
            location.href = '<?php echo base_url(); ?>index.php/popup/hak_akses/' + kode + '/' + id_menu + '/'+ action +'/'+ flag;
        }
    }
</script>

<div id="content">
    <h3 class="title-popup">Hak Akses Pengguna</h3>



    <div class="DivTable">
        <div class="box-control">
            <?php
            ?>
        </div>
        <table class="GridTable">

            <!--  ************   begin form search ****************** -->
            <tr class="form-search">
                <td colspan="8">
                    <?php echo $fp; ?>
                </td>
            </tr>
            <!-- ************   end form search ********************* -->

            <tr class="GridHeader">
                <td>No.</td>
                <td>ID Menu</td>
                <td>Nama Menu</td>
                <td>Kelompok Menu</td>
                <td>Set Read</td>
                <td>Set Modify</td>
                <td>Set Delete</td>
            </tr>
            <?php
            if ($rows > 0) {
                $nomor = $offset;
                foreach ($data as $row) {
                    $nomor++;
                    $styleTR = "GridItem1";
                    ?>
                    <tr class="<?php echo $styleTR; ?>">
                        <td><?php echo $nomor; ?></td>
                        <td><?php echo $row->id_menu; ?></td>
                        <td><?php echo $row->menu; ?></td>
                        <td><?php echo $row->menu_induk; ?></td>
                        <td >
                            <?php
                            if ($arrHakAkses[$row->id_menu]["is_read"]) {
                                echo "<a href=\"#\" class=\"setaktif\" title=\"Set Non Aktif\" onclick=\"javascript:setIsActive('" . $kode . "', '" . $row->id_menu . "', 'isread', '1')\">&nbsp;</a>";
                            } else {
                                echo "<a href=\"#\" class=\"setnonaktif\" title=\"Set Aktif\" onclick=\"javascript:setIsActive('" . $kode . "', '" . $row->id_menu . "', 'isread', '0')\">&nbsp;</a>";
                            }
                            ?>
                        </td>
                        <td >
                            <?php
                            if ($arrHakAkses[$row->id_menu]["is_modify"]) {
                                echo "<a href=\"#\" class=\"setaktif\" title=\"Set Non Aktif\" onclick=\"javascript:setIsActive('" . $kode . "', '" . $row->id_menu . "', 'ismodify', '1')\">&nbsp;</a>";
                            } else {
                                echo "<a href=\"#\" class=\"setnonaktif\" title=\"Set Aktif\" onclick=\"javascript:setIsActive('" . $kode . "', '" . $row->id_menu . "', 'ismodify', '0')\">&nbsp;</a>";
                            }
                            ?>
                        </td>
                        <td >
                            <?php
                            if ($arrHakAkses[$row->id_menu]["is_delete"]) {
                                echo "<a href=\"#\" class=\"setaktif\" title=\"Set Non Aktif\" onclick=\"javascript:setIsActive('" . $kode . "', '" . $row->id_menu . "', 'isdelete', '1')\">&nbsp;</a>";
                            } else {
                                echo "<a href=\"#\" class=\"setnonaktif\" title=\"Set Aktif\" onclick=\"javascript:setIsActive('" . $kode . "', '" . $row->id_menu . "', 'isdelete', '0')\">&nbsp;</a>";
                            }
                            ?>
                        </td>
                    </tr>

                    <?php
                }
            } else {
                ?>
                <tr class="GridItem1">
                    <td colspan="5">Tidak ada data</td>
                </tr>

                <?php
            }
            ?>
        </table>
    </div>
    <?php echo $paging; ?>
    <br class="bersih" />
    <script type="text/javascript">

        function exportData(){
            location.href = '<?php echo $__CFG_http_root; ?>index.php/popup/hak_akses/<?php echo $kode; ?>/?act=exp&<?php echo $_SERVER["QUERY_STRING"] ?>';
        }

        jQuery(document).ready(function(){
            jQuery(".form-search").hide();

            jQuery('.search').click(
            function(){
                jQuery(".form-search").slideToggle();
            }
        );

        });

    </script>